package com.xhs.controller;

import com.xhs.message.ReturnResult;
import com.xhs.service.UploadFileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @desc:
 * @projectName: tools-parent
 * @author: xhs
 * @date: 2023/3/13 20:04
 * @version: JDK 1.8
 */
@Slf4j
@RestController
@RequestMapping("/upload")
public class UploadFileController {
    @Autowired
    private UploadFileService uploadFileService;

    /**
     * 上传文件
     *
     * @param file
     * @return ReturnResult<Object>
     */
    @PostMapping("/file")
    public ReturnResult<Object> uploadFile(@RequestParam("file") MultipartFile file) {
        return uploadFileService.uploadFile(file);
    }
}
